package com.SouthernWall_404.AgeSuitcase.Common.init;

import com.SouthernWall_404.AgeSuitcase.Common.AgeSuitcase;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;

// ModSounds.java
public class ModSounds {
    public static final DeferredRegister<SoundEvent> SOUND_EVENTS =
            DeferredRegister.create(ForgeRegistries.SOUND_EVENTS, AgeSuitcase.MODID);

    // GUI 相关音效
    public static final RegistryObject<SoundEvent> LOGIN_SCREEN_MUSIC =
            registerSoundEvent("screen.login");


    public static final RegistryObject<SoundEvent> GUI_BUTTON_CLICK =
            registerSoundEvent("gui.click");
    public static final RegistryObject<SoundEvent> GUI_LOADING_FINISH =
            registerSoundEvent("gui.finish");
    public static final RegistryObject<SoundEvent> GUI_LOADING_TYPING =
            registerSoundEvent("gui.typing");


    // 辅助方法
    private static RegistryObject<SoundEvent> registerSoundEvent(String name) {
        return SOUND_EVENTS.register(name, () ->
                SoundEvent.createVariableRangeEvent(new ResourceLocation(AgeSuitcase.MODID, name)));
    }

    public static void register(IEventBus eventBus) {
        SOUND_EVENTS.register(eventBus);
    }
}
